package com.kkang.ch3.conditional;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @author yongk_liu
 **/
@Configuration
@ComponentScan("com.kkang.ch3.conditional")
public class ConditionConfig {

    @Bean
    @Conditional(WindowsCondition.class)//这里指定了条件判断类，反射创建这个类在判断条件
    public ListService windowsListService() {
        return new WindowsListServiceImpl();
    }

    @Bean
    @Conditional(LinuxCondition.class)//这里指定了条件判断类，反射创建这个类在判断条件
    public ListService linuxListService() {
        return new LinuxListServiceImpl();
    }

}
